package qianting.news.search.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import qianting.news.apis.models.search.dtos.HistorySearchDto;
import qianting.news.common.entity.State;
import qianting.news.search.service.ApUserSearchService;

/**
 * <p>
 * APP用户搜索信息表 前端控制器
 * </p>
 *
 */
@Api(tags = "搜索历史管理")
@Slf4j
@RestController
@RequestMapping("/history")
public class ApUserSearchController{

    @Autowired
    private ApUserSearchService apUserSearchService;

    //加载用户的所有搜索记录
    @ApiOperation(value = "加载用户的所有搜索记录")
    @PostMapping("load")
    public State findUserSearch() {
        return apUserSearchService.findUserSearch();
    }

    //删除用户的一条搜索记录
    @ApiOperation(value = "删除用户的一条搜索记录")
    @PostMapping("del")
    public State delUserSearch(@RequestBody HistorySearchDto historySearchDto) {
        return apUserSearchService.delUserSearch(historySearchDto);
    }

}